﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FlexFlow.Model
{
    /// <summary>
    /// 表示数据插槽，用来规定流程与活动的相关启动数据
    /// </summary>
    public class DataSlot : PhysicalModel, INamedPhysicalModel
    {
        /// <summary>
        /// 表示插槽的名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 表示插槽的类型
        /// </summary>
        public string Type { get; set; }
        /// <summary>
        /// 表示插槽是否是必须赋值的
        /// </summary>
        public bool Required { get; set; }
        public override bool Equals(object obj)
        {
            if (!(obj is DataSlot))
            {
                return false;
            }
            return (obj as DataSlot).Identity == this.Identity;
        }
        public override int GetHashCode()
        {
            return this.Identity.GetHashCode();
        }
    }
    /// <summary>
    /// 表示系统数据槽
    /// </summary>
    public static class SystemDataSlots
    {
        /// <summary>
        /// 表示用户进入流程时提交的表单插槽的插槽ID
        /// </summary>
        public static Guid ProcessEnterFormDataSlotID = new Guid("209BBC84-B608-4A61-895D-53CCE25DFB7A");
        /// <summary>
        /// 表示流程进入流程时提交的表单插槽
        /// </summary>
        public static DataSlot ProcessEnterFormDataSlot(Guid formId)
        {
            return new DataSlot()
            {
                Name = "活动表单",
                Identity = ProcessEnterFormDataSlotID,
                Required = true,
                Type = "Form",
                Tag = formId
            };
        }
    }
}
